package cn.edu.hunau.basic.day02;

import org.junit.Test;

import java.util.Random;

/**
 * @author hb
 * @date 2025-07-29 16:50:41
 */
public class WhileText {
    @Test
    public void test03(){
        int a=6;
        System.out.println(a>5?5:5.0);
    }


    @Test
    public void testFor(){
        Random r=new Random();
        for(int i=0;i<6;i++){
            int a= r.nextInt(33)+1;
            System.out.println(a);
        }
    }

    @Test
    public void testWhile2(){
        int i=0;
        while(i<100){
            //只输出偶数
            if(i%2==0){
                //如果i能够被4整除,不打印
                if(i%4 == 0){
                    i++;
                    continue; //跳出当次循环,执行下一次循环
                }
                System.out.println(i);
            }
            //如果i的值是88,跳出循环
            if(i==88){
                break;//终止当前的循环
            }
            i++;
        }
    }

    @Test
    public void testWhile(){
        Random r=new Random();
        int count =0;
        //获得6个随机数
        while(count<6){
            int a= r.nextInt(33)+1; // [1,33]
            System.out.println(a);
            count++;
        }
     }
}
